home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / BCCollec / Structs / Sets / BCSetU.h < prev   
Encoding:
Text File  |  1994-04-21  |  1.9 KB  |  65 lines  |  [TEXT/MPS ]

  1. //  The C++ Booch Components (Version 2.1)
  2. //  (C) Copyright 1990-1993 Grady Booch. All Rights Reserved.
  3. //
  4. //  BCSetU.h
  5. //
  6. //  This file contains the declaration of the unbounded set.
  7.  
  8. #ifndef BCSETU_H
  9. #define BCSETU_H 1
  10.  
  11. #include "BCNodes.h"
  12. #include "BCUnboun.h"
  13. #include "BCHashTa.h"
  14. #include "BCSet.h"
  15.  
  16. // Unbounded set
  17.  
  18. template<class Item, BC_Index Buckets, class StorageManager>
  19. class BC_TUnboundedSet : public BC_TSet<Item> {
  20. public:
  21.  
  22.   BC_TUnboundedSet();
  23.   BC_TUnboundedSet(BC_Index (*)(const Item&));
  24.   BC_TUnboundedSet(const BC_TUnboundedSet<Item, Buckets, StorageManager>&);
  25.   virtual ~BC_TUnboundedSet();
  26.  
  27.   virtual BC_TSet<Item>& operator=(const BC_TSet<Item>&);
  28.   virtual BC_TSet<Item>&
  29.     operator=(const BC_TUnboundedSet<Item, Buckets, StorageManager>&);
  30.   virtual BC_Boolean operator==(const BC_TSet<Item>&) const;
  31.   virtual BC_Boolean
  32.     operator==(const BC_TUnboundedSet<Item, Buckets, StorageManager>&) const;
  33.   BC_Boolean operator!=(const BC_TUnboundedSet<Item, Buckets, StorageManager>&) const;
  34.  
  35.   virtual void SetHashFunction(BC_Index (*)(const Item&));
  36.   virtual void Clear();
  37.   virtual BC_Boolean Add(const Item&);
  38.   virtual BC_Boolean Remove(const Item& at);
  39.  
  40.   virtual BC_Index Extent() const;
  41.   virtual BC_Boolean IsEmpty() const;
  42.   virtual BC_Boolean IsMember(const Item&) const;
  43.   
  44.   static void* operator new(size_t);
  45.   static void operator delete(void*, size_t);
  46.  
  47. protected:
  48.  
  49.   BC_TTable<Item, BC_Boolean, Buckets,
  50.             BC_TUnbounded<BC_TPair<Item, BC_Boolean>, StorageManager> > fRep;
  51.  
  52.   virtual void Purge();
  53.   virtual BC_Boolean Attach(const Item&, const BC_Boolean&);
  54.   virtual BC_Boolean Attach(const Item&);
  55.   virtual BC_Boolean Detach(const Item&);
  56.   virtual BC_Index Cardinality() const;
  57.   virtual BC_Index NumberOfBuckets() const;
  58.   virtual BC_Index Length(BC_Index bucket) const;
  59.   virtual BC_Boolean Exists(const Item&) const;
  60.   virtual const Item& ItemAt(BC_Index bucket, BC_Index index) const;
  61.   
  62. };
  63.  
  64. #endif
  65.